package pl.edu.pw.polygen.db.entieties;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="FILES")
public class PolyFile {
	
	private Long fileId;
	private String fileName;
	private String description;
	private Date createDate;
	private Date modificationDate;
	private String content;
	private Project project;
	
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "files_seq")
	@SequenceGenerator(name="files_seq", sequenceName = "files_seq")
	@Column(name="FILE_ID",nullable=false)
	public Long getFileId() {
		return fileId;
	}
	
	public void setFileId(Long fileId) {
		this.fileId = fileId;
	}
	
	@Column(name="FILE_NAME", nullable=false, length=128)
	public String getFileName() {
		return fileName;
	}
	
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	
	@Column(name="DESCRIPTION", nullable=true, length=1024)
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Column(name="CREATE_DATE",nullable=false)
	public Date getCreateDate() {
		return createDate;
	}
	
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	@Column(name="MODIFICATION_DATE", nullable=false)
	public Date getModificationDate() {
		return modificationDate;
	}
	
	public void setModificationDate(Date modificationDate) {
		this.modificationDate = modificationDate;
	}
	
	@Column(name="CONTENT", nullable=true)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@ManyToOne
	@JoinColumn(name="PROJECT_ID")
	public Project getProject() {
		return project;
	}
	
	public void setProject(Project project) {
		this.project = project;
	}

	
}
